<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='main'){
	$id=intval($_RQ['orderid']);
	if(!$id){
		exi('请先选择订单','error','list');
	}
	$_SESSION['taxi']['orderid']=$id;
	$invoice=pdo_get('jy_mapfuwu_invoice',array('id'=>$id));
	if($invoice){
		exi('您已申请发票，请勿重复申请','error');
	}
	exi($return);
}
if($_RQ['op']=='post'){
	$id=$_SESSION['taxi']['orderid'];
	$order=pdo_get('jy_mapfuwu_order',array('id'=>$id));
	$postdata=get_postdata();
	$data=array_fields(array('content','address'),$postdata);
	$data['order_id']=$id;
	$data['uniacid']=$_SESSION['uniacid'];
	$data['mid']=$_SESSION['uid'];
	$data['createtime']=TIMESTAMP;
	$data['order_id']=$id;
	$data['price']=$order['price'];
	$data['status']=0;
	pdo_insert('jy_mapfuwu_invoice',$data);
	exi('提交成功','','/home/');
}
?>